﻿<Window x:Class="WPFDemo.WPFDemoWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:demoControls="clr-namespace:WPFDemo"
    Title="WPF ScalingModal Controls Demo" 
        Height="750" Width="522"
        Loaded="Window_Loaded" >
    <Window.Resources>
        <ResourceDictionary>
        <LinearGradientBrush x:Key="GroupBackground" EndPoint="0.5,1" StartPoint="0.5,0" SpreadMethod="Pad" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#FFFFFFFF" Offset="0"/>
            <GradientStop Color="#FFFFFFFF" Offset="1"/>
            <GradientStop Color="#FF96CE99" Offset="0.515"/>
            <GradientStop Color="#FFD7E7D5" Offset="0.445"/>
        </LinearGradientBrush>
            
        </ResourceDictionary>
    </Window.Resources>

    <Grid Name="MainGrid" >
        <Grid Name="InnerGrid" >
            <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                <GradientStop Color="#FFFFFFFF" Offset="1"/>
                <GradientStop Color="#FF88BB85" Offset="0.236"/>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions >
                <RowDefinition Height="50" />
                <RowDefinition Height="500" />
                <RowDefinition Height="160" />
            </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
           <ColumnDefinition Width="500" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.ColumnSpan="3" Margin="0,5,0,0" Foreground="Black"  Name="TitleTextBlock" HorizontalAlignment="Center" TextAlignment="Center" FontSize="24"  VerticalAlignment="Top" Text="WPF Scaling Modal Control Demo" RenderTransformOrigin="0.5,0.5" >
        	<TextBlock.RenderTransform>
        		<TransformGroup>
        			<ScaleTransform ScaleX="1" ScaleY="1"/>
        			<SkewTransform AngleX="0" AngleY="0"/>
        			<RotateTransform Angle="0"/>
        			<TranslateTransform X="0" Y="0"/>
        		</TransformGroup>
        	</TextBlock.RenderTransform>
        </TextBlock>




        <Grid Panel.ZIndex="30" x:Name="ScalingModalExample" Grid.Row="1" Grid.Column="1" RenderTransformOrigin="0.5,0.5" Background="{DynamicResource GroupBackground}" >
            <Grid.RenderTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                    <SkewTransform AngleX="0" AngleY="0"/>
                    <RotateTransform Angle="0"/>
                    <TranslateTransform X="0" Y="0"/>
                </TransformGroup>
            </Grid.RenderTransform>
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="50" />
                </Grid.RowDefinitions>
                <TextBlock Margin="10" TextWrapping="Wrap" VerticalAlignment="Top" >
                    <Run Text="     The Scaling Modal Control can be used when modal pop-up functionality is desired." />
                    <LineBreak />
                    <Run Text="     It takes a given control and presents it to the user while blocking out both mouse and keyboard input from interacting with the rest of the application.  Unlike a MessageBox, the control lives in the same window as the rest of the application." />
                    <LineBreak />
                    <Run Text="     The current implementation of the Scaling Modal Control has the control acting as a singleton.  This gives easy access of the functionality to any controls acting as pop-ups (so they can easily close themselves and return control to the main application).  However, this pattern also prevents more than one Scaling Modal Control from being used per application." />
                    <LineBreak />
                    <Run Text="     To use the Scaling Modal Control, call the Initialize() method when setting up the app, and pass it a parent for the control and a panel (optional) to disable when the popped-up control is expanded." />
                    <LineBreak />
                    <Run Text="     Then, just call Expand(), passing in the control that should be popped up..." />
                    <LineBreak />
                    <Run Text="     (Click on the Expand button below)" />
                    </TextBlock>
                <Button Name="ExpandButton"  Grid.Row="1" Click="ExpandButton_Click" Content="Expand" Width="150"  Height="30" />

                <Border Grid.ColumnSpan="2" Grid.RowSpan="2" BorderThickness="3" BorderBrush="{StaticResource StandardBorderBrush}"  />
                
            </Grid>
        </Grid>
        <Grid Panel.ZIndex="29" Grid.Row="2" Grid.Column="1" x:Name="ScalingModalExampleSettings" RenderTransformOrigin="0.5,0.5" Background="{DynamicResource GroupBackground}" >
            <Grid.RenderTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                    <SkewTransform AngleX="0" AngleY="0"/>
                    <RotateTransform Angle="0"/>
                    <TranslateTransform X="0" Y="0"/>
                </TransformGroup>
            </Grid.RenderTransform>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock TextAlignment="Right" VerticalAlignment="Center" Margin="5" >Animation:</TextBlock>
                <ComboBox Name="AnimationSelectionComboBox" Grid.Column="1" Margin="5" VerticalAlignment="Center" SelectedIndex="0"  SelectionChanged="AnimationSelectionComboBox_SelectionChanged" >
                    <ComboBox.Items>
                        <ComboBoxItem Name="Random" Content="Random"  />
                        <ComboBoxItem Name="None" Content="None"  />
                        <ComboBoxItem Name="ScaleI" Content="Scale In"  />
                        <ComboBoxItem Name="ScaleO" Content="Scale Out"  />
                        <ComboBoxItem Name="ScaleV" Content="Scale Vertical"  />
                        <ComboBoxItem Name="ScaleH" Content="Scale Horizontal"  />
                        <ComboBoxItem Name="RotateCW" Content="Rotate Clockwise"  />
                        <ComboBoxItem Name="RotateCCW" Content="Rotate Counter-Clockwise"  />
                        <ComboBoxItem Name="SlideR" Content="Slide Right"  />
                        <ComboBoxItem Name="SlideL" Content="Slide Left"  />
                        <ComboBoxItem Name="SlideT" Content="Slide Top"  />
                        <ComboBoxItem Name="SlideB" Content="Slide Bottom"  />
                        <ComboBoxItem Name="Fade" Content="Fade"  />
                        <ComboBoxItem Name="Twist" Content="Twist"  />
                        <ComboBoxItem Name="Skew1" Content="Skew 1"  />
                        <ComboBoxItem Name="Skew2" Content="Skew 2"  />
                        <ComboBoxItem Name="Skew3" Content="Skew 3"  />
                        <ComboBoxItem Name="Skew4" Content="Skew 4"  />
                        <ComboBoxItem Name="Flip" Content="Flip"  />
                    </ComboBox.Items>
                </ComboBox>

                <TextBlock Grid.Row="1" TextAlignment="Right" VerticalAlignment="Center" Margin="5" >Background Opacity:</TextBlock>
                <Slider Grid.Row="1" Grid.Column="1" Margin="5" Minimum="0" Maximum="1.0" VerticalAlignment="Center" Name="BackgroundOpacitySlider" ValueChanged="BackgroundOpacitySlider_ValueChanged" Value="0.5" />

                <Border Grid.ColumnSpan="2" Grid.RowSpan="2" BorderThickness="3" BorderBrush="{StaticResource StandardBorderBrush}"  />
                
            </Grid>
        </Grid>

        

           
            <TextBlock Height="Auto" Margin="11,34,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" TextWrapping="Wrap" FontWeight="Bold" FontFamily="Arial" FontSize="18" FontStyle="Italic" x:Name="ScalingModalTitleShadow" Canvas.ZIndex="50" RenderTransformOrigin="0.1,0.5">
            	<TextBlock.RenderTransform>
            		<TransformGroup>
            			<ScaleTransform/>
            			<SkewTransform/>
            			<RotateTransform/>
            			<TranslateTransform/>
            		</TransformGroup>
            	</TextBlock.RenderTransform><Run Foreground="#AA000000" Text="Scaling Modal Control:"/></TextBlock>
            
           
            <TextBlock Height="Auto" Margin="10,33,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" TextWrapping="Wrap" FontWeight="Bold" FontFamily="Arial" FontSize="18" FontStyle="Italic" x:Name="ScalingModalTitle" Canvas.ZIndex="50" RenderTransformOrigin="0.1,0.5" Foreground="#FF000000">
            	<TextBlock.RenderTransform>
            		<TransformGroup>
            			<ScaleTransform/>
            			<SkewTransform/>
            			<RotateTransform/>
            			<TranslateTransform/>
            		</TransformGroup>
            	</TextBlock.RenderTransform><Run Foreground="#FF3EDD79" Text="Scaling Modal Control:"/></TextBlock>
           

         
            <TextBlock Height="Auto" Margin="11,476,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" TextWrapping="Wrap" FontWeight="Bold" FontFamily="Arial" FontSize="16" FontStyle="Italic" x:Name="ScalingModalSettingsShadow" Canvas.ZIndex="50" RenderTransformOrigin="0.1,0.5" IsHitTestVisible="False" >
            	<TextBlock.RenderTransform>
            		<TransformGroup>
            			<ScaleTransform/>
            			<SkewTransform/>
            			<RotateTransform/>
            			<TranslateTransform/>
            		</TransformGroup>
            	</TextBlock.RenderTransform><Run Foreground="#AA000000" Text="Settings:"/></TextBlock>
           

           
            <TextBlock Height="Auto" Margin="10,475,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" TextWrapping="Wrap" FontWeight="Bold" FontFamily="Arial" FontSize="16" FontStyle="Italic" x:Name="ScalingModalSettings" Canvas.ZIndex="50" RenderTransformOrigin="0.1,0.5" Foreground="#FF000000" IsHitTestVisible="False" >
            	<TextBlock.RenderTransform>
            		<TransformGroup>
            			<ScaleTransform/>
            			<SkewTransform/>
            			<RotateTransform/>
            			<TranslateTransform/>
            		</TransformGroup>
            	</TextBlock.RenderTransform><Run Foreground="#FF3EDD79" Text="Settings:"/></TextBlock>
           


        </Grid>
    </Grid>
</Window>
